module FileMover
  require 'fileutils'
  def move_dir(from,to)
    a = Dir.new from
    FileUtils.mkdir to
    a.each do |f|
      unless f=~ /^\..*/
        if is_dir?(File.join(from,f))
          move_dir(File.join(from,f),File.join(to,f)) 
        else
          FileUtils.cp(File.join(from,f),File.join(to,f))
        end
      end
    end
    a = Dir.new from
    a.each do |f|
      FileUtils.rm(File.join(from,f)) unless f=~ /^\..*/
    end
    a = nil
    FileUtils.rmdir(from)
  end
  def is_dir? o
    File.exists?(o) && File.directory?(o)
  end
end
